import Restful from '@/api/restful-api'
import request from '@/utils/request'

const GOODS_BASE_URL = '/goods'

export const goodsRestful = new Restful(GOODS_BASE_URL)

/**
 * 默认的查询条件
 * @type {{orderInfo: string[], pageSize: defaultQueryConditions.pageSize, currentPage: defaultQueryConditions.currentPage}}
 */
const defaultQueryConditions = {
  pageSize: 10,
  currentPage: 1,
  orderInfo: ['-createdTime']
}

export const queryAdminGoodsList = function(query) {
  return request({
    url: `${GOODS_BASE_URL}/admin/list`,
    method: 'get',
    params: { ...defaultQueryConditions, ...query }
  })
}

